import scala.collection.mutable.ArrayBuffer

/**
 * 内部类访问外部类对象成员
 * 1）outer =>
 * 2）Network.this
 * @param name
 */
class Network(val name: String) {
  outer =>
  class Member(val name: String) {
    val contacts = new ArrayBuffer[Member]
//    def description = name + " inside " + outer.name
    def description = name + " inside " + Network.this.name
  }

  private val members = new ArrayBuffer[Member]

  def join(name: String) = {
    val m = new Member(name)
    members += m
    m
  }
}

val chatter = new Network("Chatter")
val myFace = new Network("MyFace")

val fred = chatter.join("Fred")
println(fred.description);
val barney = myFace.join("Barney")
println(barney.description);
